export function saveAuth(token, user) {
	uni.setStorageSync('token', token || '');
	uni.setStorageSync('user', user || null);
}

export function getUser() {
	try {
		return uni.getStorageSync('user') || null;
	} catch (e) {
		return null;
	}
}

export function clearAuth() {
	uni.removeStorageSync('token');
	uni.removeStorageSync('user');
}

export function isAuthed() {
	try {
		return !!uni.getStorageSync('token');
	} catch (e) {
		return false;
	}
}


